package com.initial;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.initial.entity.*;
import com.initial.mapper.TbCrmContactsMapper;
import com.initial.mapper.TbCrmEmailRecordMapper;
import com.initial.mapper.TbCrmTaskMapper;
import com.initial.mapper.TbSystemRoleFunctionMapper;
import com.initial.service.TbCrmEmployeeService;
import com.initial.service.TbCrmTaskService;
import com.initial.service.TbSystemUserService;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

@SpringBootTest
public class Text1 {
    @Resource
    private TbSystemRoleFunctionMapper tbSystemRoleFunctionMapper;
    @Resource
    private TbCrmTaskMapper tbCrmTaskMapper;
    @Resource
    private TbCrmTaskService tbCrmTaskService;
    @Resource
    private TbSystemUserService tbSystemUserService;
    @Resource
    private TbCrmEmailRecordMapper tbCrmEmailRecordMapper;
    @Resource
    private TbCrmEmployeeService employeeService;
    @Test
    public void text2(){
       /* List<VMenu> tbSystemRoleFunctions = tbSystemRoleFunctionMapper.selectListId(1);
        System.out.println(tbSystemRoleFunctions);*/
        TbSystemRoleFunction tbSystemRoleFunction = tbSystemRoleFunctionMapper.selectByIdRole(1, 11);
        if (tbSystemRoleFunction==null){
            System.out.println(false);
        }
        System.out.println(tbSystemRoleFunction);

    }
    @Test
    public void text3(){
        /*IPage<TbCrmEmailRecord> tbCrmEmailRecordIPage = tbCrmEmailRecordMapper.selectAllPage(new Page<>(1, 5), 1);
        System.out.println(tbCrmEmailRecordIPage.getRecords());*/
        QueryWrapper<TbCrmEmployee> queryWrapper=new QueryWrapper<TbCrmEmployee>();
        queryWrapper.eq("user_id",4);
        TbCrmEmployee employee = employeeService.getOne(queryWrapper);
        System.out.println(employee);
    }
    @Test
    public void text4(){
        UpdateWrapper updateWrapper=new UpdateWrapper();
        updateWrapper.set("delete_user_id",1);
        updateWrapper.eq("id",11);
        updateWrapper.set("delete_status",1);
        Date date=new Date();
        updateWrapper.set("delete_time",date);
        boolean update = tbCrmTaskService.update(updateWrapper);
        System.out.println(update);
    }
}
